const { tokenLogger } = require('./util')
const { T_UID } = require('./dbHelper')

async function query(env) {
  tokenLogger('info', 'query', `begin query table t_userid with env is ${env}`)
  const envMapper = {
    'mirror': 0,
    'prod': 1
  }
  if (env !== undefined) {
    const tmpEnv = envMapper[`${env}`.toLowerCase()]
    if (tmpEnv !== undefined) {
      return await T_UID.query(`env = ${tmpEnv}`)
    }
  }
  return await T_UID.query(``)
}

module.exports = { query }
